<?php $this->headLink()->prependStylesheet(Ac_Util::getImageBaseUrl('/css/custom_ad_detail.v-'.AC_VERSION.'.css'))?>
<?php $this->headLink()->appendStylesheet(Ac_Util::getImageBaseUrl('/css/custom_acc.v-'.AC_VERSION.'.css'))?>
<?php $this->headLink()->appendStylesheet(Ac_Util::getImageBaseUrl('/css/custom_serp.v-'.AC_VERSION.'.css'))?>
<?php $this->jQuery()->uiEnable()?>
<?php $this->headStyle()->captureStart()?>
.toggle  {float:none;clear:both;}
<?php $this->headStyle()->captureEnd()?>
<?php $this->placeholder('container-class')->set('acc friend fan')?>
<section id="updated_message" style="display:none;" class="alert success">
	<p><?php echo $this->t('Your Information has been updated')?><a class="close" href="#" id="close_thankyou"><?php echo $this->t('关闭');?></a></p>
</section>
<article class="article box">
	<?php echo $this->partial('index/my-account-side.phtml', array('select'=> 'home')) ?>
	<section class="main_section">
		<h3><?php echo $this->t('我的朋友');?></h3>
		<section class="result gallery hor">
			<section class="business_personal">  
				<?php if (!empty($this->loggedin_user->cid)):?>
                <a href="<?php echo $this->geturl('my-account-following', 'user')?>" class="selected"><em><?php echo $this->t('我关注的人');?></em> (<?php echo (int)$this->loggedin_user->company->count_following;?>)</a>	
				<a href="<?php echo $this->geturl('my-account-follower', 'user')?>"><em><?php echo $this->t('我的粉丝');?></em> (<?php echo (int)$this->loggedin_user->company->count_followers;?>)</a>
				<a href="<?php echo $this->geturl('my-account-like', 'user')?>"><em><?php echo $this->t('喜欢我的宝贝');?></em> (<?php echo (int)$this->loggedin_user->company->count_likes?>)</a>	
            <?php else:?>
                <a href="<?php echo $this->geturl('my-account-following', 'user')?>" class="selected"><em><?php echo $this->t('我关注的人');?></em> (<?php echo (int)$this->loggedin_user->count_following;?>)</a>	
				<a href="<?php echo $this->geturl('my-account-follower', 'user')?>"><em><?php echo $this->t('我的粉丝');?></em> (<?php echo (int)$this->loggedin_user->count_followers;?>)</a>
				<a href="<?php echo $this->geturl('my-account-like', 'user')?>"><em><?php echo $this->t('喜欢我的宝贝');?></em> (<?php echo (int)$this->loggedin_user->count_likes?>)</a>
            <?php endif;?>		
			</section>
			<?php if($this->listing_number > 0):?>
			<ul class="user">
				<?php foreach($this->list as $item):?>
				<?php
					$url = $name = $pic = '';
					if($item->user_type == 1){
						$count = Model_Listing::all(array('us' => $item->us_f, 'sa' => Model_Listing::STATUS_PUBLISHED))->count();
						$u		= Model_User::find($item->us_f);
						$url	= $u->url();//$this->geturl('display', 'user', array('user' => $u), 'user1', $params);
						$name 	= $u->name;
						$pic	= $u->pp;
					}else{					
						$count = Model_Listing::all(array('us' => $item->user_followed->_id, 'sa' => Model_Listing::STATUS_PUBLISHED))->count();
						$url	= $item->user_followed->url();			
						$name 	= $item->user_followed->username;
						$pic	= $item->user_followed->image;
					}
				?>
				<li>
					<dl>              
						<dt>
							<figure><a href="<?php echo $url?>"><img src="<?php echo $this->thumbnail()->scale($pic, 100, 100, true, true);?>"></a></figure>
						</dt>
						<dd class="name">
							<h2><a href="<?php echo $url?>"><?php echo $name?></a></h2>
						</dd>
						<dd class="count"><?php echo $count?><?php echo $this->t('件宝贝');?></dd>
						<!--dd class="remove">
							<a href="#"><?php echo $this->t('移除粉丝');?></a>              
						</dd-->
					</dl>
				</li>
				<?php endforeach;?>
			</ul>
			<?php else: ?>
			<p class="no_ad button em"><?php echo $this->t('你還沒有關注任何用戶，不妨在本網站溜一回，找一些有趣的用戶去關注吧！');?></p>
			<?php endif;?>
			<!--section class="search">
				<form>
				<input type="text">
				<button>Search</button>
				</form>
			</section-->
			<section class="nav option top">
				<dl class="page">
				<dd> 
				<?php if(!empty($this->list)):?>
					<?php
                    $get = $_REQUEST;
                    unset($get['page']);
                    $pagination = $this->pagination($this->listing_number, $this->page, $this->per_page, 4, $this->geturl('my-account-following', 'user', null, null, $get), '&page=');
                    echo $pagination;
                	?>
                <?php endif;?>
				</dd>
				</dl>
			</section>
			<section class="nav option bottom">
				<dl class="page">
				<dd>
				<?php if(!empty($this->list)):?>
					<?php
                    $get = $_REQUEST;
                    unset($get['page']);
                    $pagination = $this->pagination($this->listing_number, $this->page, $this->per_page, 4, $this->geturl('my-account-following', 'user', null, null, $get), '&page=');
                    echo $pagination;
                	?>
                <?php endif;?>
				</dd>
				</dl>
			</section>
		</section>
	</section>
	<aside class="aside">
	</aside>
</article>